# -*- coding: utf-8 -*-
# time: 2025/4/18 15:53
# file: ch01.py
# author: hanson
import os

from openai import OpenAI
client = OpenAI(
    api_key="sk-62fb03f9198f4720bb359c873757fafc", # 如果您没有配置环境变量，请在此处用您的API Key进行替换
    base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",  # 填写DashScope服务的base_url
)

completion = client.chat.completions.create(
    model="qwen-turbo",
    messages=[
        {'role': 'system', 'content': 'You are a helpful assistant.'},
        {'role': 'user', 'content': '你是谁？'}],
    temperature=0.8
)
print(completion.choices[0].message.content)